<!--
  Expects the following variables:
  volumes
  namespace
 -->
<div ng-repeat="volume in volumes">
  <h4>
    {{volume.name}}
    <span ng-if="canRemove" class="header-actions">
      <a href="" ng-click="removeFn({volume: volume})">Remove</a>
    </span>
  </h4>
  <dl class="dl-horizontal left">
    <div ng-if="volume.secret">
      <dt>Type:</dt>
      <dd>
        secret
        <span class="small text-muted">(populated by a secret when the pod is created)</span>
      </dd>
      <dt>Secret:</dt>
      <dd>
        <span ng-if="'secrets' | canI : 'get'">
          <a ng-href="{{volume.secret.secretName | navigateResourceURL : 'Secret' : namespace}}">{{volume.secret.secretName}}</a>
        </span>
        <span ng-if="!('secrets' | canI : 'get')">
          {{volume.secret.secretName}}
        </span>
      </dd>
      <div ng-repeat="item in volume.secret.items">
        <dt>Key to File:</dt>
        <dd>{{item.key}}&#8201;&#8594;&#8201;{{item.path}}</dd>
      </div>
    </div>
    <div ng-if="volume.persistentVolumeClaim">
      <dt>Type:</dt>
      <dd>
        persistent volume claim
        <span class="small text-muted">(reference to a persistent volume claim)</span>
      </dd>
      <dt>Claim name:</dt>
      <dd><a ng-href="{{volume.persistentVolumeClaim.claimName | navigateResourceURL : 'PersistentVolumeClaim' : namespace}}">{{volume.persistentVolumeClaim.claimName}}</a></dd>
      <dt>Mode:</dt>
      <dd>
        <span ng-if="volume.persistentVolumeClaim.readOnly">read-only</span>
        <span ng-if="!volume.persistentVolumeClaim.readOnly">read-write</span>
      </dd>
    </div>
    <div ng-if="volume.hostPath">
      <dt>Type:</dt>
      <dd>
        host path
        <span class="small text-muted">(bare host directory volume)</span>
       </dd>
      <dt>Path:</dt>
      <dd>{{volume.hostPath.path}}</dd>
    </div>
    <div ng-if="volume.emptyDir">
      <dt>Type:</dt>
      <dd>
        empty dir
       <span class="small text-muted">(temporary directory destroyed with the pod)</span>
       </dd>
      <dt>Medium:</dt>
      <dd>
        <span ng-if="!volume.emptyDir.medium">node's default</span>
        <span ng-if="volume.emptyDir.medium">{{volume.emptyDir.medium}}</span>
      </dd>
    </div>
    <div ng-if="volume.gitRepo">
      <dt>Type:</dt>
      <dd>
        git repo
       <span class="small text-muted">(pulled from git when the pod is created)</span>
      </dd>
      <dt>Repository:</dt>
      <dd>{{volume.gitRepo.repository}}</dd>
      <dt ng-if-start="volume.gitRepo.revision">Revision:</dt>
      <dd ng-if-end>{{volume.gitRepo.revision}}</dd>
    </div>
    <div ng-if="volume.downwardAPI">
      <dt>Type:</dt>
      <dd>
        downward API
        <span class="small text-muted">(populated with information about the pod)</span>
       </dd>
      <div ng-repeat="item in volume.downwardAPI.items">
        <dt>Volume File:</dt>
        <dd>{{item.fieldRef.fieldPath}}&#8201;&#8594;&#8201;{{item.path}}</dd>
      </div>
    </div>
    <div ng-if="volume.configMap">
      <dt>Type:</dt>
      <dd>
        config map
        <span class="small text-muted">(populated by a config map)</span>
       </dd>
      <dt>Config Map:</dt>
      <dd><a ng-href="{{volume.configMap.name | navigateResourceURL : 'ConfigMap' : namespace}}">{{volume.configMap.name}}</a></dd>
      <div ng-repeat="item in volume.configMap.items">
        <dt>Key to File:</dt>
        <dd>{{item.key}}&#8201;&#8594;&#8201;{{item.path}}</dd>
      </div>
    </div>
  </dl>
</div>
